From: Aryeh Gregor Date: Tue, 31 Mar 2009 14:26:40 +0000 (+0000) Subject: Don't add empty title attributes to anchor links X-Git-Tag: 1.31.0-rc.0~42260 X-Git-Url: http://git.cyclocoop.org/%7D%7Cconcat%7B?a=commitdiff_plain;h=01a4aa14b31ce212729f7a3bd434d0b7cecd29cc;p=lhc%2Fweb%2Fwiklou.git Don't add empty title attributes to anchor links All parser tests updated. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 7494d12cb7..198821d666 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -313,6 +313,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN with tags, helps with text-based browsers * (bug 18259) Special:DeletedContributions now also uses MediaWiki:Sp-contributions-logs for the link to Special:Log +* Don't add empty title="" attributes to links to anchors on the current page == API changes in 1.15 == * (bug 16858) Revamped list=deletedrevs to make listing deleted contributions diff --git a/includes/Linker.php b/includes/Linker.php index e862c3be81..e916b040b0 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -291,7 +291,10 @@ class Linker { } # Get a default title attribute. - if( in_array( 'known', $options ) ) { + if( $target->getPrefixedText() == '' ) { + # A link like [[#Foo]]. This used to mean an empty title + # attribute, but that's silly. Just don't output a title. + } elseif( in_array( 'known', $options ) ) { $defaults['title'] = $target->getPrefixedText(); } else { $defaults['title'] = wfMsg( 'red-link-title', $target->getPrefixedText() ); diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt index 1a42700567..c7d0bc2895 100644 --- a/maintenance/parserTests.txt +++ b/maintenance/parserTests.txt @@ -1454,7 +1454,7 @@ Example for such a section: == < == !! input [[%23%3c]][[%23%3e]] !! result -

#<#> +

#<#>

!! end @@ -4662,7 +4662,7 @@ Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id= !! input byte[[#æ: v|backlink]] !! result -

bytebacklink +

bytebacklink

!! end